import fs from 'fs'

export default {
  paths() {
    return fs
      .readdirSync('src')
      .map((dir) => {
        if (!dir.startsWith('_') && dir !== 'icons') {
          try {
            return fs.readdirSync(`src/${dir}/demo`).map((demo) => {
              return {
                params: {
                  demo: `${dir}/${/.*(?=\.vue$)/.exec(demo)[0]}`,
                },
              }
            })
          } catch (error) {}
        }
      })
      .filter(Boolean)
      .flat()
  },
}
